package com.sky.controller;

import com.sky.entity.TWalletRecord;
import com.sky.service.TWalletRecordService;
import org.apache.ibatis.annotations.Param;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import com.github.pagehelper.PageInfo;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (TWalletRecord)表控制层
 *
 * @author sky
 * @since 2022-11-15 11:56:23
 */
@RestController
@RequestMapping("tWalletRecord")
public class TWalletRecordController {
    /**
     * 服务对象
     */
    @Resource
    private TWalletRecordService tWalletRecordService;


	/**
     * 分页查询查询用户钱包金额变动明细
     * @param tWalletRecord 筛选条件
     * @return 查询结果
     */
	@GetMapping()
    public Object queryByPage(@RequestBody TWalletRecord tWalletRecord) {
        PageInfo<TWalletRecord> outVo = tWalletRecordService.queryByPage(tWalletRecord);
        Map<String, Object> obj = new HashMap<String, Object>();
        obj.put("content", outVo.getList());
        obj.put("total", outVo.getTotal());
        return obj;
    }
	

    /**
     * 通过主键查询单条数据
     * @param walletRecordId 主键
     * @return 单条数据
     */
	@GetMapping("{walletRecordId}")
    public Object queryById(@PathVariable("walletRecordId") Long walletRecordId) {
        TWalletRecord tWalletRecord = tWalletRecordService.queryById(walletRecordId);
        Map<String, Object> obj = new HashMap<String, Object>();
        obj.put("status", "Success");
        obj.put("content", tWalletRecord);
        return obj;
    }

}

